{% extends  'wechat.base.html' %}
{% block title%}
客户列表
{% endblock %}

{% block wechat_content%}
<!--主体-->
  <!-- <h2 class="blue_title">客户列表</h2> -->
  {% if customers %}
  {% for customer in customers %}
    <h3 class="blue_title" style="cursor: pointer;" onclick="toggle('tbl{{forloop.counter}}')">{{customer.truename}}[{{customer.get_stars_display}}]</h3>
    <table id = "tbl{{forloop.counter}}" style="display: none;" class="table table-striped table-bordered">
      {% for project in customer.project_set.all %}
        <tr><td><h4><a href="/account/project/{{project.id}}" target="_blank"><b><span class="{% if project.actual_date_completed %}green_title{% else %}blue_title{% endif %}">{{project.name}}</span></b></a></h4></td></tr>
        <tr><td>
    <p>项目重要度：{{project.get_stars_display}}</p>
    <p>项目负责人：<b>{{customer.owner.profile.truename}}</b></p>
    <p>成立日期：<u>{{project.date_established}}</u><br/></p>
    {% if project.estemated_date_completed %}<p>预计完成日期：<u>{{project.estemated_date_completed}}</u></p>{% endif %}
    <p>项目状态：{%if project.actual_date_completed %}<span class="green_title">已完成(<u>{{project.actual_date_completed}}</u>)</span>{% else %}<span class="blue_title">正在跟进中</span>{% endif %}</p>
    </td></tr>
      {% endfor %}
    </table>
  {% endfor %}
  {% endif %}
<!--主体 end-->
{% endblock %}

{% block footer_script %}
  <script type="text/javascript">
    function toggle(targetid){
      if (document.getElementById){
        target=document.getElementById(targetid);
        if (target.style.display=="none"){
          target.style.display="";
        } else {
          target.style.display="none";
        }
      }
    }
  </script>
{% endblock %}
